-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow decimal amounts #293
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Entering digits works, e.g. for this conservation project https://donate-with-planet-47idl2tvg-planetapp.vercel.app/?to=proj_NPmia9Vh6Ub91nuw2KmWY9uh - but not with German amounts using a comma (",") as a separater which we never really supported (at once place we just automatically replaced every entered comma (",") with a dot (".")). Bouquet projects I could not test as the only active ones on staging do not have custom amounts. |
Maybe we can change the regex for the German language. |
e.target.value = e.target.value | ||
.replace(/[^0-9^\.]+/g, "") | ||
.replace(".", "$#$") | ||
.replace(/\./g, "") | ||
.replace("$#$", ".") | ||
.replace(/^0+/, ""); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this won't allow to input a "," as used as separater for German values, but afterwards will print the amount, e.g. "5.5." in a localized form e.g. "5,5" for German language. It works and we probably cannot support an input parser for every kind of currency formatting, but I am not sure if everybody will understand this logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @norbertschuler, it might be confusing. If it is not possible to find a solution, we should think about a helper text that explains it to the user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So close this PR or keep it?
PR is too old, closing this. |
This PR addresses issue #190